package practice;

import java.util.Random;
import java.util.Scanner;

public class Text10 {
    public static void main(String[] args) {
        String num="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        String answer="";
        Random rand=new Random();
        for (int i=0;i<10;i++){
            char a=num.charAt(rand.nextInt(num.length()));
            answer+=a;
        }
        System.out.println("验证码为:"+answer);
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入:");
        String a=scan.nextLine();
        a=a.toLowerCase();
        answer=answer.toLowerCase();
        if(a.equals(answer)){
            System.out.println("输入正确");
        }else {
            System.out.println("输入错误");
        }
    }
}
